//
//  SISSRepaymentRedemptionShowViewModel.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/10/25.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSRepaymentRedemptionShowViewModel.h"

@implementation SISSRepaymentRedemptionShowViewModel

- (NSString *)plistName {
    return @"RepaymentRedemptionInfoArray";
}

- (UIView *)getViewHeaderInSection:(NSInteger)section {
    
    SISSBaseView *headerView = [[SISSBaseView alloc] init];
    headerView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    UILabel *label = [[UILabel alloc] init];
    label.textColor = COLOR(0x334A60);
    label.font = [UIFont systemFontOfSize:16];
    [headerView addSubview:label];
    
    CGFloat margin = 8.0;
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerView).offset(2 * margin);
        make.centerY.equalTo(headerView);
    }];
    
    NSArray *headerTextArr = @[@"买方贷款银行放赎楼款", @"担保公司还款情况", @"补充说明"];
    
    label.text = headerTextArr[section];
    
    return headerView;
}

- (CGFloat)getHeightForHeaderInSection:(NSInteger)section {
    return 44;
}

- (void)assignmentWithRepaymentRedemptionModel:(SISSRepaymentRedemptionModel *)repaymentRedemptionModel {
    NSDictionary *infoDict = [repaymentRedemptionModel yy_modelToJSONObject];
    for (NSInteger section = 0; section < self.dataArr.count; section++) {
        
        for (NSInteger idx = 0; idx < self.dataArr[section].count; idx++) {
            
            SISSContractModel *obj = self.dataArr[section][idx];
            obj.rightStr = infoDict[obj.propertyKey] != nil ? [NSString stringWithFormat:@"%@",infoDict[obj.propertyKey]] : @"";
        }
    }
    
    [self.tableView reloadData];
}

@end
